import request from '@/utils/request'

export default {
    //1.添加课程信息
    addCourseInfo(courseInfo) {
        return request({
            //url: '/table/list',
            url: `/eduservice/course/addCourseInfo`,
            method: 'post',
            data: courseInfo
        })
    },

    //2.查询所有讲师用于显示
    getListTeacher() {
        return request({
            //url: '/table/list',
            url: `/eduservice/teacher/findAll`,
            method: 'get'
        })
    },

    //3.根据课程id查询课程基本信息
    getCourseInfoId(courseId) {
        return request({
            //url: '/table/list',
            url: `/eduservice/course/getCourseInfo/${courseId}`,
            method: 'get'
        })
    },

    //4.修改课程信息
    updateCourseInfoId(courseInfo) {
        return request({
            //url: '/table/list',
            url: `/eduservice/course/updateCourseInfo`,
            method: 'post',
            data: courseInfo
        })
    },

    //课程最终信息确认
    getPublishCourseInfo(id) {
        return request({
            //url: '/table/list',
            url: `/eduservice/course/getPublishCourseInfo/${id}`,
            method: 'get'
        })
    },

    //课程的最终发布
    publishCourse(id) {
        return request({
            //url: '/table/list',
            url: `/eduservice/course/publishCourse/${id}`,
            method: 'post'
        })
    },

    //1.课程列表（条件查询分页
    //参数:当前页，每页记录数，条件对象
    getCourseListPage(current, limit, courseQuery) {
        return request({
            //url: '/table/list',
            url: `/eduservice/course/pageCourseCondition/${current}/${limit}`,
            method: 'post',
            //courseQuery条件对象，后端使用RequestBody获取数据
            //data表示把对象转换json进行传递到接口中
            data: courseQuery
        })
    },

    //2.删除
    deleteCourseId(id) {
        return request({
            url: `/eduservice/course/${id}`,
            method: 'delete'
        })
    },
}
